/**
 * 给定数组A，当某个Ai达到10以后，就会消失，并向左右各发射1
 * 1碰到最近的Ai就会加进去，否则飞向无穷远。问左右无穷远给飞了多少个1
 * 直接模拟即可
 */
#include <bits/stdc++.h>
using namespace std;

#include <bits/extc++.h>
using namespace __gnu_pbds;

using llt = long long;
using vi = vector<int>;

int N, P;
vi A;

void proc(){
    P -= 1;
    if(A[P] != 9) return (void)(cout << "0 0\n");

    int lans = 0, rans = 0;
    int left = P - 1, right = P + 1;
    int kl = 1, kr = 1;
    while(1){
        if(kl){
            kl -= 1;
            if(left < 0){
                ++lans;                
            }else{
                if(10 == ++A[left]){
                    left -= 1;
                    kl += 1, kr += 1;
                }            
            }            
        }

        if(kr){
            kr -= 1;
            if(right >= N){
                ++rans;
            }else{
                if(10 == ++A[right]){
                    right += 1;
                    kl += 1, kr += 1;
                }
            }
        }

        if(0 == kl and 0 == kr) break;
    }
    return (void)(cout << lans << " " << rans << "\n");
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);
    int nofkase = 1;
    cin >> nofkase;
    while(nofkase--){
        cin >> N >> P;
        A.assign(N, {});
        for(auto & i : A) cin >> i;
        proc();
    }
    return 0;
}